<?php
class Goldens_Model extends ORM {
	
	protected $table_name = 'goldens';
	protected $primary_key = 'goldens_id';
	protected $col_sort_order = 'goldens_sort_order';
	protected $col_goldens_status = 'goldens_status';
	protected $sorting = array('goldens_update_date' => 'desc');
	
	public function get()
	{
		$this->db->from($this->table_name);
		$this->db->select('*');
		$this->db->orderby($this->col_sort_order,'desc');
		$this->db->orderby($this->primary_key,'desc');
		$query = $this->db->get();
		return $query->result_array(false);
		
	}
	
	public function get_with_active($language)
	{
		$this->db->select('*');
		$this->db->from($this->table_name);
		$this->db->join('goldens_content', 'goldens_content.goldens_id', 'goldens.goldens_id');
		$this->db->where('goldens_content.languages_id',$language);
		$this->db->where($this->col_goldens_status,'1');
		$this->db->orderby('goldens.'.$this->col_sort_order,'asc');
		//$this->db->orderby('goldens.'.$this->primary_key,'desc');
		$query = $this->db->get();
		return $query->result_array(false);
		
	}
}
?>